package com.yzc.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yzc.pojo.Tour;
import com.yzc.service.TourService;
import com.yzc.mapper.TourMapper;
import com.yzc.util.ResultData;
import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

import java.io.InputStream;
import java.time.LocalTime;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author Yzc
 * @description 针对表【t_tour】的数据库操作Service实现
 * @createDate 2024-06-13 15:28:57
 */
@Service
public class TourServiceImpl extends ServiceImpl<TourMapper, Tour>
        implements TourService {

    @Autowired
    private TourMapper tourMapper;


    @Override
    public List<Tour> selectInfos(Tour tourname) {
        QueryWrapper<Tour> queryWrapper = new QueryWrapper<>();
        if (tourname != null && tourname.getTourname() != null) {
            String likeValue = "%" + tourname.getTourname() + "%";
            queryWrapper.like("tourname", likeValue);
        }
        return tourMapper.selectList(queryWrapper);
    }

    @Override
    public void deleteInfos(int tourid) {
        tourMapper.deleteById(tourid);
        tourMapper.updatePveList();
    }

    @Override
    public void saveInfos(Tour tour) {
        tourMapper.insert(tour);
        tourMapper.updatePveList();
    }

    @Override
    public void updateInfos(Tour tour) {
        tourMapper.updateInfos(tour);
        tourMapper.updatePveList();
    }

    @Override
    public Tour getTourid(Integer tourid) {
        return tourMapper.selectById(tourid);
    }

    @Override
    public List<Tour> loadAllTourData() {
        return tourMapper.loadAllTourData();
    }


}




